/**
 * @file Constant.hpp
 * @brief 常量定义
 * @author Creeper
 * @date 2021-07-21
 * @version V1.0
 *
 * @note None
 **/
#ifndef __CONSTANT__
#define __CONSTANT__

#include <tuple>
#include <string>
#include <utility>

using namespace std;

/**
 * @brief 朝向，相对方向
 **/
enum Direction
{
    LEFT = 0,
    FRONT = 1,
    RIGHT = 2,
    BACK = 3
};

/**
 * @brief 朝向，绝对方向
 **/
enum Orientation
{
    WEST = 0,
    SOUTH = 1,
    EAST = 2,
    NORTH = 3
};

namespace GameConfiguration{
    constexpr int FPS_RATE = 60; ///< 帧率
    constexpr string_view PATH_TO_ANSICON = "./ANSICin/ansicon.exe";
}
typedef pair<int, int> POINT, VECT;
typedef pair<POINT, VECT> RECT;
namespace GameMap
{
    constexpr int MAP_SIZE_X = 25; ///< X方向地图大小
    constexpr int MAP_SIZE_Y = 25; ///< Y方向地图大小
}
namespace Screen{
    constexpr VECT SCREEN_SIZE = {40, 120};
    constexpr POINT AREA_MAP_LEFTTOP = {0, 0};
    constexpr VECT AREA_MAP_SIZE = {25, 50};
    constexpr RECT AREA_MAP = {AREA_MAP_LEFTTOP, AREA_MAP_SIZE};
}
struct COLOR{
    typedef unsigned char uchar;
    uchar R, G, B;
    constexpr COLOR() : R(0), G(0), B(0) {}
    constexpr COLOR(uchar _R, uchar _G, uchar _b) : R(_R), G(_G), B(_B) {}
    constexpr COLOR(unsigned digit){
        B = digit & 0xff;
        G = (digit >>= 0x8) & 0xff;
        R = (digit >>= 0x8) & 0xff;
    }
    constexpr explicit operator unsigned(){
        return (R << 0x10) | (G << 0x8) | B;
    }
};
struct CHARACTER{
    char c;
    COLOR foreGround, backGround;
    constexpr CHARACTER() : c(0), foreGround(), backGround(){}
    constexpr CHARACTER(char _c, COLOR _f, COLOR _b) : c(_c), foreGround(_f), backGround(_b){}
};
namespace ColorScheme{
    constexpr CHARACTER snakeHead = {};
    constexpr CHARACTER snakeBody = {};
    constexpr CHARACTER horizontalLine = {};
    constexpr CHARACTER verticalLine = {};
    constexpr CHARACTER fruitNormal = {};
    constexpr CHARACTER fruitBouns = {};
}
#endif